import BtnList from '../components/btn_list'
import PaginationNumber from '../components/pagination'
import http from '../APIService/http'
import VueLazyload from 'vue-lazyload'
const globalComponents = {
  install: function (Vue) { // 核心部分，在我们使用Vue.use()时，自动调用的是install，而install导出的必须是的组件
    let prefix = ''
    if (process.env.NODE_ENV === 'production') {
      prefix = '/api/'
    } else {
      prefix = '/'
    }
    Vue.use(VueLazyload, {
      preLoad: 1.3,
      loading: require('../assets/imgs/lazy.png'),
      error: require('../assets/imgs/error.png'),
      attempt: 1
    })
    Vue.prototype.$prefix = prefix
    Vue.prototype.$http = http
    Vue.component('btnList', BtnList)
    Vue.component('PaginationNumber', PaginationNumber)
  }
};

export default globalComponents;